<!DOCTYPE html>
<html>
  
  <head>
    <meta charset="UTF-8">
    <title>欢迎页面-L-admin1.0</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width,user-scalable=yes, minimum-scale=0.4, initial-scale=0.8,target-densitydpi=low-dpi" />
    <link rel="shortcut icon" href="/static/favicon.ico" type="image/x-icon" />
    <link rel="stylesheet" href="/static/css/font.css">
    <link rel="stylesheet" href="/static/css/xadmin.css">
    <script src="/static/js/jquery.min.js"></script>
    <script type="text/javascript" src="/static/lib/layui/layui.js" charset="utf-8"></script>
    <script type="text/javascript" src="/static/js/xadmin.js"></script>
    <!-- 让IE8/9支持媒体查询，从而兼容栅格 -->
    <!--[if lt IE 9]>
      <script src="https://cdn.staticfile.org/html5shiv/r29/html5.min.js"></script>
      <script src="https://cdn.staticfile.org/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <style>
        .body-content {
            display: block;
            background-color: #fff;
            min-width: 1600px;
            min-height: 1200px;
            margin: auto;
            margin-top: 10px;
            width: 98%;
            height: 98vh;
        }
        .piece {
            border: 1px solid #8a8a8a;
            margin-left: 10px;
            display: inline-block;
        }

        .piece .title {
            width: 100%;
            height: 40px;
            line-height: 40px;
            background: rgba(118, 162, 6, 1);
            border: 1px solid rgba(138, 138, 138, 1);
            text-align: center;
            color: #fff;
            font-size: 19px;
        }

        .piece .content ul {
            margin: 0px;
            padding: 0px;
            display: inline-block;
        }

        .piece .content ul li {
            width: 100%;
            list-style: none;
            display: block;
            height: 35px;
            border-bottom: 1px solid #000;
        }

        .piece .content ul li:nth-last-child(1) {
            border: none;
        }

        .piece .content ul li span {
            width: 120px;
            text-align: right;
            color:#fff;
            background: rgba(138, 138, 138, 1);
            display: inline-block;
            height: 35px;
            line-height: 36px;
            padding-right: 10px;
            padding-left: 10px;
        }
        .piece .content ul li span:hover{
            background-color:rgba(0, 176, 80, 1);
        }
        .piece .content ul li input {
            text-indent: 10px;
            border: none;
            width: 160px;
            height: 33px;
            line-height: 33px;
            padding: 0px;
            margin: 0px;
        }

        .piece .content ul li select {
            display: inline-block;
            text-indent: 10px;
            border: none;
            background: none;
            width: 160px;
            height: 35px;
            line-height: 35px;
            padding: 0px;
            margin: 0px;
        }

        .company-buy {
            position: absolute;
            top: 36px;
            left: 20px;
        }
        .button {
            background: rgba(0, 176, 80, 1);
            color: #fff;
            position: absolute;
            top:{$total}px;
            /* top:250px; */
            width: 120px;
            height: 40px;
            line-height: 40px;
            text-align: center;
            text-decoration: none;
        }
        .button-add{
            left:30px;
        }
        .button-save{
            left:160px;
        }
        .button-app{
            left:290px;
        }
    </style>
  </head>
  <body>
    <div class="body-content">
        <!-- <form class="layui-form"> -->
        <div class="piece company-buy">
            <div class="title">
                询价方
            </div>
            <div class="content">
                <ul id="ul-list">
                    {volist name="info" id="value"}
                    <li onclick="selected(this,'{$value.id}')" id="li-{$value.id}">
                        <span>{$value.name}:</span>
                        <input type="text" id="{$value.id}" disabled>
                    </li>
                    {/volist}
                </ul>
            </div>
        </div>
        <a href="javascript:x_admin_show('编辑','/admin/input?type=company');" class="button-add button">点击增行</a>
        <a href="javascript:save();" class="button-save button">修改信息</a>
        <a href="javascript:del();" class="button-app button">删除信息</a>
        <!-- </form> -->
    </div>
    <script>
        var selected_id = '';
        function selected(obj,id){
            selected_id = id;
            let span;
            let ul = document.getElementById('ul-list');
            let li = ul.getElementsByTagName('li');
            for(let index in li){
                if(!li[index].id)continue;
                span = li[index].getElementsByTagName('span')[0];
                span.style = '';
            }
            span = obj.getElementsByTagName('span')[0];
            span.style = 'background-color:rgba(0, 176, 80, 1);';
        }
        function save(){
            console.log(selected_id);
            if (!selected_id)return alert('未选中要修改的对象');
            x_admin_show('编辑','/admin/input?type=company&field=save&id=' + selected_id);
        }
        function del(){
            $.ajax({
                url: '/admin/input?type=company&field=del&id=' + selected_id, // 你的 PHP 脚本的 URL  
                type: 'post', // 请求类型，可以是 'GET' 或 'POST'  
                dataType: 'json', // 预期服务器返回的数据类型  
                data: {id:selected_id},
                success: function(data) { 
                    location.reload();
                }
            });
        }
    </script>
  </body>
</html>